﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CarCricketMatchApp
{
    public partial class SelectPlaystylesForm : Form
    {
        private PlayerStyles selectStyle;

        public PlayerStyles SelectStyle
        {
            get { return selectStyle; }
        }

        public SelectPlaystylesForm()
        {
            InitializeComponent();
            selectStyle = PlayerStyles.Hitter;
        }

        private void SelectPlaystylesForm_Load(object sender, EventArgs e)
        {
            this.comboBoxStyle.SelectedIndex = 0;
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            string selectText = (string)this.comboBoxStyle.SelectedItem;


            switch (selectText)
            {
                case "Hitter":
                    {
                        this.selectStyle = PlayerStyles.Hitter;
                        break;
                    }
                case "Balanced":
                    {

                        this.selectStyle = PlayerStyles.Balanced;
                        break; 
                    }
                case "Defensive":
                    {
                        this.selectStyle = PlayerStyles.Defensive;
                        break;
                    }
                default:
                    break; ;
            }
            this.Close();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
